import antfu from '@antfu/eslint-config'

export default antfu(
  {
    unocss: true,
    formatters: {
      prettierOptions: {
        printWidth: 80,
        tabWidth: 2,
        useTabs: false,
        semi: false,
        singleQuote: true,
        quoteProps: 'as-needed',
        jsxSingleQuote: false,
        trailingComma: 'none',
        bracketSpacing: true,
        jsxBracketSameLine: false,
        htmlWhitespaceSensitivity: 'css',
        arrowParens: 'avoid',
        endOfLine: 'lf',
      },
    },
    vue: {
      overrides: {
        'style/brace-style': ['error', 'stroustrup'],
        'vue/block-tag-newline': 'off',
        'vue/valid-v-on': 'warn',
        'vue/max-attributes-per-line': [
          'error',
          {
            singleline: {
              max: 1,
            },
            multiline: {
              max: 1,
            },
          },
        ],
        'vue/block-order': [
          'error',
          {
            order: ['script', 'template', 'style'],
          },
        ],
        // "script-setup", "composition", "composition-vue2", or "options"
        'vue/component-api-style': ['error', ['script-setup', 'composition']],
        'vue/component-name-in-template-casing': [
          'error',
          'kebab-case',
          {
            registeredComponentsOnly: false,
          },
        ],
        'vue/define-props-declaration': ['error', 'type-based'],
        'vue/no-multi-spaces': [
          'error',
          {
            ignoreProperties: false,
          },
        ],
      },
    },
  },
  {
    rules: {
      'style/brace-style': ['error', '1tbs'],
      'ts/ban-ts-comment': 'off',
      'no-console': 'warn',
      'unused-imports/no-unused-vars': [
        'warn',
        {
          vars: 'all',
          varsIgnorePattern: '^_',
          args: 'after-used',
          argsIgnorePattern: '^_',
        },
      ],
    },
  },
)
